// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import store from './store'
import router from './router'

import Mint from 'mint-ui';
import 'mint-ui/lib/style.css'

Vue.use(Mint);
Vue.config.productionTip = false

if (process.env.NODE_ENV == 'development') {
    Vue.prototype.mp_id = '25845437513a9098447548e9928eacc3e5bbf64e';
    Vue.prototype.team_id = '1027052245cb5380b4174f4abec263a67f881a5f';
    Vue.prototype.user_id = '26235784d9b3ca0867ab47fb9db959a7e0bf3ab1';
    Vue.prototype.browser_type = 1;
    Vue.prototype.wx_pay_way = 'special_sub';
    Vue.prototype.unified_pay_host = 'xueban.vstudy.net.cn';
    Vue.prototype.mp_info = {
        wx_qrcode_url: 'http://mmbiz.qpic.cn/mmbiz/13Y0Tvc8TjLnAmRGQw2Bss9ibDGDYEfEMNxO4ZicTBALYcNpwOtExEzgDwObvicCRpfGubvf950H3HTaY0kNiaVdLQ/0'
    };
    Vue.prototype.current_host = 'xueban.vstudy.net.cn';
} else {
    Vue.prototype.mp_id = mp_id;
    Vue.prototype.team_id = team_id;
    Vue.prototype.user_id = user_id;
    Vue.prototype.browser_type = browser_type;
    Vue.prototype.wx_pay_way = wx_pay_way;
    Vue.prototype.unified_pay_host = unified_pay_host;
    Vue.prototype.mp_info = mp_info;
    Vue.prototype.current_host = window.location.host;
}
Vue.prototype.img_url = 'http://image.imoocs.org/image/upload_web/';
Vue.prototype.wx_img_url = '/imageurl/handler?imgurl=';

Vue.filter('renderImg', function(value, width, height) {
    if (typeof value == 'undefined') {
        return '';
    }
    let fix_w_h = '';
    if (value.indexOf('http://') != -1) {
        if (typeof width != 'undefined' && typeof width != 'undefined') {
            fix_w_h = '?imageView2/1/w/' + width + '/h/' + height;
        }
        return value + fix_w_h;
    }

    if (typeof width != 'undefined' && typeof width != 'undefined') {
        fix_w_h = '/' + width + '/' + height;
    }
    return 'http://image.imoocs.org/image/upload_web/' + value + fix_w_h;
})

new Vue({
    el: '#app',
    router,
    store,
    template: '<App/>',
    components: { App }
})